package com.tony.business.controller;

import com.tony.domain.bo.UserInfo;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import springfox.documentation.annotations.ApiIgnore;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * @author tony
 * @date 2020/2/27 8:41 下午
 */
@ApiIgnore
@Data
@EqualsAndHashCode
@AllArgsConstructor
@NoArgsConstructor
public abstract class BaseController {

    @Autowired
    protected HttpServletRequest request;

    @Autowired
    protected HttpServletResponse response;

    protected UserInfo getUserInfo() {
        return (UserInfo) request.getAttribute("userInfo");
    }

}
